Skip to content

Conversation

@pkienzle
Copy link
Contributor

@pkienzle pkienzle commented Sep 18, 2025

Redo the plotting routines using a more compact layout, better suited for use with bumps webview.

This code is not used by SasView

Notes:

(1) Include both matplotlib and plotly backends.

The plotly backend isn't enabled because the bumps interface to plotly in model is not yet stable. See bumps/bumps#342

(2) plotly heatmaps do not yet display correctly in bumps

To see the plots in matplotlib and plotly type the following to load and display the plots without bumps:

python example/fit2d.py

Now switch to the fix-improve-mpl-support branch in bumps, uncomment def plotly(...) in bumps_model.Experiment.plot, then run

bumps example/fit2d.py

The plotly 2d plots are still ugly. Figure out how to shrink the graph area to just the data

(3) The limits parameter for plot_theory doesn't work for q^4 plots

(4) matplotlib log data error plots do not work with webview

This is an issue with the mpld3 library used to render them: mpld3/mpld3#488

(5) Should be sharing the 2D rebinning code with sasview

(6) The algorithm for select Δqx and Δqy when converting from a bag of (qx, qy, I(qx, qy)) values to a 2D image should be improved. Pixels should be roughly square; instead of assuming a square aspect ratio it should use the qx and qy extent ratio. The algorithm is assuming that (qx, qy) is relatively uniform throughout bounding box so it is creating a grid with approximately one measurement per pixel. This fails if the dataset has significant masking, or if it combines measurements with significant overlap. Either find a better algorithm as part of this PR or create a separate ticket asking to improve it.

(7) Although these changes mirror some of those in the sasview plotting refactor (SasView/sasview#2940 and SasView/sasview#3111) it doesn't look like higher level code sharing will be possible.

@pkienzle pkienzle marked this pull request as ready for review September 26, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants